<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'addReply.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <style>
  		*{
  			margin:0px;
  			padding:0px;
  		}
  		table{
  			width:500px;
  			text-align:center;
  			margin:200px auto 0px;
  		}
  		tr,textarea,.author{
  			width:100%;
  			height:40px;
  		}
  		tr:nth-of-type(even){
  			background-color:rgba(0,0,0,0.1);
  		}
  </style>
  
  <body>
		<c:set var="ctx" value="${pageContext.request.contextPath }" />
		<form action="${ctx }/invitation/addReplyById" class="myForm">
			<input type="hidden" name="invId" value="${id }" />
			<table border="1px" cellspacing="2px" cellpadding="0px">
				<tr>
					<td colspan="2">添加回复</td>
				</tr>
				<tr>
					<td>回复内容：</td>
					<td><textarea name="content" class="content"></textarea></td>
				</tr>
				<tr>
					<td>回复昵称：</td>
					<td><input type="text" name="author" class="author" /></td>
				</tr>
				<tr>
					<td colspan="2">
						<input type="submit" value="提交" class="submit" /> || <input type="button" value="返回" class="back" >
					</td>
				</tr>
			</table>
		</form>
	<script src="${ctx }/statics/js/jquery-1.12.4.js"></script>
	<script>
		$(function(){
			$(".back").click(function(){
				window.history.back(-1);
			});
			
			$(".myForm").submit(function(){
				var $content = $(".content");
				if($content.val() == ""){
					alert("回复内容不能为空！");
					$content.focus();
					return false;
				}
			});
		});
	</script>
  </body>
</html>
